package com.fengchao.api.controller.v1;

import com.alibaba.fastjson.JSON;
import com.fengchao.api.service.CfiService;
import com.fengchao.api.service.UsrService;
import com.fengchao.model.cfi.CfiArtistCrowdfundingApply;
import com.fengchao.model.entity.comm.CustomBizException;
import com.fengchao.model.entity.comm.Message;
import com.fengchao.model.entity.comm.ResponseParameter;
import com.fengchao.util.common.CommonValidator;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.fengchao.api.config.Constant.*;

/**
 * 众筹
 * Created by wangnian on 2016/6/13.
 */
@RestController
@RequestMapping("/v1/cfi")
public class CfiController {

    @Autowired
    private CfiService cfiService;
    @Autowired
    private UsrService usrService;

    private static Logger logger = LoggerFactory.getLogger(CfiController.class);

    @RequestMapping(value = "/getCrowdfundingList/{rank}/{page}/{count}", method = RequestMethod.GET)
    @ApiOperation(value = "(APP/WEB)获取众筹列表", notes = "返回参数:</br>成功:</br>{status: SUCCESS, </br>message: 获取成功,</br>data:{</br>&nbsp;&nbsp;total: 10(众筹的总数目),</br>&nbsp;&nbsp;info:[</br>&nbsp;&nbsp;&nbsp;{</br>&nbsp;&nbsp;&nbsp;&nbsp;expectedDurationDate: 92(),</br>&nbsp;&nbsp;&nbsp;&nbsp;expectedMoney: 440000(),</br>&nbsp;&nbsp;&nbsp;&nbsp;beforeStartTime: 0(),</br>&nbsp;&nbsp;&nbsp;&nbsp;city: 上海(),</br>&nbsp;&nbsp;&nbsp;&nbsp;nameDisplay: 张靓颖(),</br>&nbsp;&nbsp;&nbsp;&nbsp;artistId: 7(),</br>&nbsp;&nbsp;&nbsp;&nbsp;artistStyle: [{id:1(类型ID),typeName:流行(类型的名称)},{id:2,typeName:金典}] 艺人演唱风格," +
            "</br>&nbsp;&nbsp;&nbsp;&nbsp;namePy: ZhangLiangying(艺人拼音名),</br>&nbsp;&nbsp;&nbsp;&nbsp;title: 张靓颖个人演唱会 上海站2(众筹标题),</br>&nbsp;&nbsp;&nbsp;&nbsp;appIcon: http://aaa.png (艺人头像),</br>&nbsp;&nbsp;&nbsp;&nbsp;webImage: http://aaa.png (WEB端众筹照片),</br>&nbsp;&nbsp;&nbsp;&nbsp;percentage: 32(百分比),</br>&nbsp;&nbsp;&nbsp;&nbsp;appImage: http://aaa.png (APP端众筹图片),</br>&nbsp;&nbsp;&nbsp;&nbsp;crowdfundingSummary: 其实，这不是张靓颖的演唱会，我们就是挂羊头卖牛肉(众筹简介),</br>&nbsp;&nbsp;&nbsp;&nbsp;statusZh: 众筹中(众筹状态),</br>&nbsp;&nbsp;&nbsp;&nbsp;startTime: 1468339200000(众筹开始时间)," +
            "</br>&nbsp;&nbsp;&nbsp;&nbsp;expectedShares: 300(),</br>&nbsp;&nbsp;&nbsp;&nbsp;id: 290(众筹ID),</br>&nbsp;&nbsp;&nbsp;&nbsp;beforeCloseTime: 894696345(),</br>&nbsp;&nbsp;&nbsp;&nbsp;actualMoney: 100000.09(),</br>&nbsp;&nbsp;&nbsp;&nbsp;statusEn: PROCESS(众筹状态),</br>&nbsp;&nbsp;&nbsp;&nbsp;actualShares: 10009(),</br>&nbsp;&nbsp;&nbsp;&nbsp;nameEn: Jane Zhang(艺人英文名),</br>&nbsp;&nbsp;&nbsp;&nbsp;sharedUrl: http://aaa.com (分享URL),</br>&nbsp;&nbsp;&nbsp;&nbsp;nationality: 大陆(艺人国籍),</br>&nbsp;&nbsp;&nbsp;&nbsp;pcIcon: http://aaa.png (艺人头像),</br>&nbsp;&nbsp;&nbsp;&nbsp;endTime: 1474629360000(众筹结束时间)," +
            "</br>&nbsp;&nbsp;&nbsp;&nbsp;isFavorite: 0(是否收藏 1:是 0:否)</br>&nbsp;&nbsp;&nbsp;}</br>&nbsp;&nbsp;]</br>&nbsp;}</br>}" +
            "</br>失败: </br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter getCrowdfundingList(@ApiParam(value = "(APP/WEB必填)类型,APP/WEB", required = true) @RequestHeader String type,
                                                 @ApiParam(value = "用户token") @RequestHeader(required = false) String token,
                                                 @ApiParam(value = "(APP/WEB必填)排序 1:热门排序 2:最新上线 3:准备上线", required = true) @PathVariable("rank") Integer rank,
                                                 @ApiParam(value = "(APP/WEB必填)第几页", required = true) @PathVariable("page") Integer page,
                                                 @ApiParam(value = "(APP/WEB必填)显示多少行", required = true) @PathVariable("count") Integer count) {
        logger.info("获取众筹列表请求参数= type:{},token:{},rank:{},page:{},count:{}", type, token, rank, page, count);
        ResponseParameter responseParameter = new ResponseParameter(Message.SUCCESS, GET_SUCCESS);

        Integer userId = usrService.getUserId(type, token, false);

        List<Map<String, Object>> list = cfiService.getCrowdfundingList(userId, page, count, rank);
        Integer total = cfiService.getCrowdfundingListTotal(rank);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info", list);
        map.put("total", total);
        responseParameter.setData(map);
        logger.info("获取众筹列表响应参数= 总数量:{}，当前条数:{}", total, list.size());
        logger.debug("获取众筹列表响应参数= {}", JSON.toJSON(responseParameter));
        return responseParameter;
    }

    @RequestMapping(value = "/getCrowdfunding/{id}", method = RequestMethod.GET)
    @ApiOperation(value = "(APP/WEB)获取众筹详细", notes = "返回参数:</br>成功:</br>{status:SUCCESS,</br>message: 获取成功,</br>data:{</br>&nbsp;&nbsp;info:{</br>&nbsp;&nbsp;&nbsp;expectedDurationDate: 92(预计多少天),</br>&nbsp;&nbsp;&nbsp;expectedMoney: 20000(众筹目标金额),</br>&nbsp;&nbsp;&nbsp;beforeStartTime: 0(距离开始还有多久 ),</br>&nbsp;&nbsp;&nbsp;city: 上海(众筹城市),</br>&nbsp;&nbsp;&nbsp;nameDisplay: Flo Rida(佛罗·里达)-20(艺人展示名),</br>&nbsp;&nbsp;&nbsp;update: [updatedInfo: aaa(更新动态信息)updatedTime: 1467993600000(更新时间)] 艺人更新,</br>&nbsp;&nbsp;&nbsp;artistId: 1(艺人ID)," +
            "</br>&nbsp;&nbsp;&nbsp;artistStyle: [{id:1,typeName:流行},{id:2,typeName:金典}] 艺人风格,</br>&nbsp;&nbsp;&nbsp;namePy: Flo Rida-20(艺人拼音名),</br>&nbsp;&nbsp;&nbsp;title: 岁月流歌英语演唱会-22 北京站(众筹标题),</br>&nbsp;&nbsp;&nbsp;appVideo: http://swarm-dev.b0.upaiyun.com/cfi/app_detail_video/1789c3dddfd2abf2ed8eb4f5713bf1b7.jpg (APP视频),</br>&nbsp;&nbsp;&nbsp;appIcon: http://swarm-dev.b0.upaiyun.com/bci/artist_head_icon_app/113-02.png(艺人头像)," +
            "</br>&nbsp;&nbsp;&nbsp;webImage: http://swarm-dev.b0.upaiyun.com/cfi/web/cfi_web_florida.jpg (web端图片),</br>&nbsp;&nbsp;&nbsp;percentage: 0(百分比),</br>&nbsp;&nbsp;&nbsp;appImage: http://swarm-dev.b0.upaiyun.com/cfi/app_detail_image/1789c3dddfd2abf2ed8eb4f5713bf1b7.jpg (APP端众筹图片),</br>&nbsp;&nbsp;&nbsp;statusZh: 众筹成功(众筹状态),</br>&nbsp;&nbsp;&nbsp;crowdfundingSummary: aaa(众筹的简介),</br>&nbsp;&nbsp;&nbsp;startTime: 1467993600000(众筹开始时间),</br>&nbsp;&nbsp;&nbsp;expectedShares: 100(目标人数)," +
            "</br>&nbsp;&nbsp;&nbsp;id: 266(众筹id),</br>&nbsp;&nbsp;&nbsp;beforeCloseTime: 0(距离结束还有多久),</br>&nbsp;&nbsp;&nbsp;info: aaa(众筹简介),</br>&nbsp;&nbsp;&nbsp;crowdfundingLink: http://swarm-dev.b0.upaiyun.com/appAbout/fundDetailMobile.html?fundId=266 (众筹详情的Link),</br>&nbsp;&nbsp;&nbsp;actualMoney: 0(众筹实际金额),</br>&nbsp;&nbsp;&nbsp;statusEn: SUCCESS(众筹状态),</br>&nbsp;&nbsp;&nbsp;actualShares: 0(实际人数),</br>&nbsp;&nbsp;&nbsp;nameEn: Flo Rida-20(艺人英文名),</br>&nbsp;&nbsp;&nbsp;webVideo: http://aaa.com (WEB端视频)," +
            "</br>&nbsp;&nbsp;&nbsp;sharedUrl: http://swarm-dev.b0.upaiyun.com/appAbout/fundDetailShare.html?fundId=266 (分享链接),</br>&nbsp;&nbsp;&nbsp;nationality: 美国(艺人国籍),</br>&nbsp;&nbsp;&nbsp;pcIcon: http://swarm-dev.b0.upaiyun.com/bci/artist_head_icon_pc/113-01.png (艺人头像),</br>&nbsp;&nbsp;&nbsp;endTime: 1473868800000(众筹结束时间),</br>&nbsp;&nbsp;&nbsp;isFavorite: 0(是否收藏 1:是 0:否)</br>&nbsp;&nbsp;}</br>&nbsp;}</br>}" +
            "</br>失败:</br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter getCrowdfunding(@ApiParam(value = "(APP/WEB必填)类型,APP/WEB", required = true) @RequestHeader String type,
                                             @ApiParam(value = "用户token") @RequestHeader(required = false) String token,
                                             @ApiParam(value = "(APP/WEB必填)众筹id", required = true) @PathVariable("id") Integer id) {
        logger.info("获取众筹详细请求参数= type:{},token:{},id:{}", type, token, id);
        if (!CommonValidator.isStringsNotNull(type, id)) {
            throw new CustomBizException(PARAMETER_IS_NOT_COMPLETE);
        }
        ResponseParameter responseParameter = new ResponseParameter(Message.SUCCESS, GET_SUCCESS);

        Integer userId = usrService.getUserId(type, token, false);

        Map<String, Object> Crowdfundingmap = cfiService.getCfiConcertCrowdfundingSingal(userId, id);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info", Crowdfundingmap);
        responseParameter.setData(map);
        logger.info("获取众筹详细响应参数= {}", JSON.toJSON(responseParameter));
        return responseParameter;
    }

    @RequestMapping(value = "/getCrowdfundingPayBack/{id}", method = RequestMethod.GET)
    @ApiOperation(value = "(APP/WEB)获取众筹的回报", notes = "返回参数:</br>成功:</br>{status: SUCCESS, </br>message: 获取成功, </br>data:{</br>&nbsp;&nbsp;info:[</br>&nbsp;&nbsp;&nbsp;{</br>&nbsp;&nbsp;&nbsp;&nbsp;payBackId: 6(众筹回报ID),</br>&nbsp;&nbsp;&nbsp;&nbsp;payBackMemo: aaa(众筹回报备注),</br>&nbsp;&nbsp;&nbsp;&nbsp;payBackprice: 200(众筹回报价格),</br>&nbsp;&nbsp;&nbsp;&nbsp;payBackName: aaa(众筹回报名称)," +
            "</br>&nbsp;&nbsp;&nbsp;&nbsp;payBackInfo: aaa(众筹回报简介),</br>&nbsp;&nbsp;&nbsp;&nbsp;payBackResidue: 9(众筹回报剩余数量(总的数量-锁定的数量))</br>&nbsp;&nbsp;&nbsp;}</br>&nbsp;&nbsp;]</br>&nbsp;}</br>}" +
            "</br>失败:</br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter getCrowdfundingPayBack(@ApiParam(value = "(APP/WEB必填)类型, APP/WEB", required = true) @RequestHeader String type,
                                                    @ApiParam(value = "(APP/WEB必填)众筹id", required = true) @PathVariable("id") Integer id) {
        logger.info("获取众筹的回报请求参数= type:{},id:{}", type, id);
        if (!CommonValidator.isStringsNotNull(type, id)) {
            throw new CustomBizException(PARAMETER_IS_NOT_COMPLETE);
        }
        ResponseParameter responseParameter = new ResponseParameter(Message.SUCCESS, GET_SUCCESS);
        List<Map<String, Object>> payBacklist = cfiService.getCrowdfundingPayBack(id);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info", payBacklist);
        responseParameter.setData(map);
        logger.info("获取众筹的回报响应参数= {}", JSON.toJSON(responseParameter));
        return responseParameter;
    }

    @RequestMapping(value = "/getCrowdfundingUpdate/{id}", method = RequestMethod.GET)
    @ApiOperation(value = "(APP/WEB)获取众筹更新信息", notes = "返回参数:</br>成功:</br>{status: SUCCESS, </br>message: 获取成功, </br>data:{</br>&nbsp;&nbsp;info:[</br>&nbsp;&nbsp;&nbsp;{</br>&nbsp;&nbsp;&nbsp;&nbsp;updatedInfo: aaa(众筹更新的内容),</br>&nbsp;&nbsp;&nbsp;&nbsp;updatedTime: 时间戳的格式(众筹更新的时间)</br>&nbsp;&nbsp;&nbsp;}</br>&nbsp;&nbsp;]</br>&nbsp;}</br>}" +
            "</br>失败:</br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter getCrowdfundingUpdate(@ApiParam(value = "(APP/WEB必填)类型, APP/WEB", required = true) @RequestHeader String type,
                                                   @ApiParam(value = "(APP/WEB必填)众筹id", required = true) @PathVariable("id") Integer id) {
        logger.info("获取众筹更新请求参数= type:{},id:{}", type, id);
        if (!CommonValidator.isStringsNotNull(type, id)) {
            throw new CustomBizException(PARAMETER_IS_NOT_COMPLETE);
        }
        ResponseParameter responseParameter = new ResponseParameter(Message.SUCCESS, GET_SUCCESS);
        List<Map<String, Object>> updateList = cfiService.getCrowdfundingUpdate(id);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info", updateList);
        responseParameter.setData(map);
        logger.info("获取众筹更新响应参数= {}", JSON.toJSON(responseParameter));
        return responseParameter;
    }

    @RequestMapping(value = "/getFavoriteCrowdfunding/{page}/{count}", method = RequestMethod.GET)
    @ApiOperation(value = "(APP/WEB)获取收藏的众筹", notes =  "返回参数:</br>成功:</br>{status: SUCCESS, </br>message: 获取成功, </br>data:{</br>&nbsp;&nbsp;info:[</br>&nbsp;&nbsp;&nbsp;{</br>&nbsp;&nbsp;&nbsp;&nbsp;appImage: http://swarm-dev.b0.upaiyun.com/cfi/app/cfi_app_zly.jpg(众筹图片)," +
            "</br>&nbsp;&nbsp;&nbsp;&nbsp;title: 张靓颖个人演唱会 上海站(众筹标题),</br>&nbsp;&nbsp;&nbsp;&nbsp;id: 290(众筹ID)</br>&nbsp;&nbsp;&nbsp;}</br>&nbsp;&nbsp;]</br>&nbsp;}</br>}" +
            "</br>重新登录:</br>{status: RELOGIN, message: Token失效}" +
            "</br>失败:</br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter getFavoriteCrowdfunding(@ApiParam(value = "(APP/WEB必填)类型,APP/WEB", required = true) @RequestHeader(required = false) String type,
                                                     @ApiParam(value = "(APP/WEB必填)用户token", required = true) @RequestHeader String token,
                                                     @ApiParam(value = "(APP/WEB必填)第几页", required = true) @PathVariable("page") Integer page,
                                                     @ApiParam(value = "(APP/WEB必填)显示多少行", required = true) @PathVariable("count") Integer count) {
        ResponseParameter responseParameter = new ResponseParameter(Message.SUCCESS, GET_SUCCESS);
        logger.info("获取收藏的众筹请求参数= type：{},token:{},page:{},count:{}", type, token, page, count);
        if (!CommonValidator.isStringsNotNull(type, token, page, count)) {
            throw new CustomBizException(PARAMETER_IS_NOT_COMPLETE);
        }
        Integer userId = usrService.getUserId(type, token, true);
        List<Map> list = cfiService.getFavoriteCrowdfunding(page, count,userId);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info", list);
        responseParameter.setData(map);
        logger.debug("获取收藏的众筹响应参数={}", JSON.toJSON(responseParameter));
        logger.info("获取收藏的众筹响应参数= 获取的数量{}", list.size());
        return responseParameter;
    }

    @RequestMapping(value = "/countEstimate", method = RequestMethod.POST)
    @ApiOperation(value = "(WEB)计算众筹申请预估成本的接口", notes =  "返回参数：</br>成功: </br>{status: SUCCESS, </br>message: 获取成功,</br>data:{</br>&nbsp;&nbsp;info:{</br>&nbsp;&nbsp;&nbsp;minTickets: 6000(最小参与人数),</br>&nbsp;&nbsp;&nbsp;estimateCost: 100000(估算总费用),</br>&nbsp;&nbsp;&nbsp;estimateTicketPrice: 100(估算平均票价)</br>&nbsp;&nbsp;}</br>&nbsp;}</br>}" +
            "</br>重新登录:</br>{status: RELOGIN, message: Token失效}" +
            "</br>失败:</br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter countEstimate(@ApiParam(value = "(必填)类型, WEB", required = true) @RequestHeader String type,
                                           @ApiParam(value = "(必填)用户token, ", required = true) @RequestHeader String token,
                                           @ApiParam(value = "(必填)艺人数量", required = true) @RequestParam Integer artistNumber,
                                           @ApiParam(value = "(必填)助理数量", required = true) @RequestParam Integer crewNumber,
                                           @ApiParam(value = "(必填)行程天数", required = true) @RequestParam Integer schedulingDays,
                                           @ApiParam(value = "(必填)演出规模", required = true) @RequestParam Integer showScale,
                                           @ApiParam(value = "(必填)演出次数", required = true) @RequestParam Integer showTimes,
                                           @ApiParam(value = "(必填)最小上座率", required = true) @RequestParam Integer minAttendance,
                                           @ApiParam(value = "(必填)其他设备要求", required = true) @RequestParam String otherEquipment,
                                           @ApiParam(value = "(必填)酒店入住天数", required = true) @RequestParam Integer resideInDays,
                                           @ApiParam(value = "(必填)艺人住宿标准", required = true) @RequestParam Integer artistHotelLevel,
                                           @ApiParam(value = "(必填)助理入住标准", required = true) @RequestParam Integer crewHotelLevel,
                                           @ApiParam(value = "(必填)出发地区", required = true) @RequestParam Integer setOffRegion,
                                           @ApiParam(value = "(必填)艺人舱位标准", required = true) @RequestParam Integer artistFlightClass,
                                           @ApiParam(value = "(必填)助理舱位标准", required = true) @RequestParam Integer crewFlightClass,
                                           @ApiParam(value = "(必填)艺人地面交通标准", required = true) @RequestParam Integer artistGroundTransportation,
                                           @ApiParam(value = "(必填)助理地面交通标准", required = true) @RequestParam Integer crewGroundTransportation,
                                           @ApiParam(value = "(必填)是否需要签证", required = true) @RequestParam Boolean needVisa,
                                           @ApiParam(value = "(必填)是否有大型行李", required = true) @RequestParam Boolean hasOversizedLuggage,
                                           @ApiParam(value = "(必填)演出费用", required = true) @RequestParam Integer performanceFee) {
        ResponseParameter responseParameter = new ResponseParameter(Message.SUCCESS, GET_SUCCESS);
        logger.info("计算众筹申请预估成本请求参数= type：{},token:{},artistNumber:{},crewNumber:{},schedulingDays:{},showScale:{},showTimes:{},minAttendance:{},otherEquipment:{},resideInDays:{}," +
                "artistHotelLevel:{},crewHotelLevel:{},setOffRegion:{},artistFlightClass:{},crewFlightClass:{},artistGroundTransportation:{},crewGroundTransportation:{},needVisa:{},performanceFee:{},performanceFee:{}",
                type, token, artistNumber, crewNumber, schedulingDays, showScale, showTimes, minAttendance, otherEquipment, resideInDays,
                artistHotelLevel, crewHotelLevel, setOffRegion,artistFlightClass, crewFlightClass, artistGroundTransportation, crewGroundTransportation,
                needVisa, hasOversizedLuggage, performanceFee);
        if (!CommonValidator.isStringsNotNull(type)) {
            throw new CustomBizException(PARAMETER_IS_NOT_COMPLETE);
        }
        Integer userId = usrService.getUserId(type, token, true);
        Map<String, Object> estimate = cfiService.countEstimate(userId, artistNumber, crewNumber, schedulingDays, showScale, showTimes, minAttendance, otherEquipment, resideInDays,
                artistHotelLevel, crewHotelLevel, setOffRegion,artistFlightClass, crewFlightClass, artistGroundTransportation, crewGroundTransportation, needVisa, hasOversizedLuggage, performanceFee);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info", estimate);
        responseParameter.setData(map);
        logger.debug("计算众筹申请预估成本响应参数={}", JSON.toJSON(responseParameter));
        return responseParameter;
    }

    @RequestMapping(value = "/setCfiArtistCrowdfundingApplay", method = RequestMethod.POST)
    @ApiOperation(value = "(WEB)保存艺人申请的众筹接口", notes =  "返回参数:</br>成功:</br>{status: SUCCESS, message: 获取成功}" +
            "</br>重新登录:</br>{status: RELOGIN, message: Token失效}" +
            "</br>失败:</br>{status: FAILURE, message: 参数不全}")
    public ResponseParameter setCfiArtistCrowdfundingApplay(@ApiParam(value = "(必填)类型, WEB", required = true) @RequestHeader String type,
                                           @ApiParam(value = "(必填)用户token, ", required = true) @RequestHeader String token,
                                           @ApiParam(value = "(必填)档期开始时间", required = true) @RequestParam String availiableScheduleStart,
                                           @ApiParam(value = "(必填)档期结束时间", required = true) @RequestParam String availiableScheduleEnd,
                                           @ApiParam(value = "(必填)艺人数量", required = true) @RequestParam Integer artistNumber,
                                           @ApiParam(value = "(必填)助理数量", required = true) @RequestParam Integer crewNumber,
                                           @ApiParam(value = "(必填)目标城市", required = true) @RequestParam String targetCity,
                                           @ApiParam(value = "(必填)行程天数", required = true) @RequestParam Integer schedulingDays,
                                           @ApiParam(value = "(必填)演出规模", required = true) @RequestParam Integer showScale,
                                           @ApiParam(value = "(必填)演出次数", required = true) @RequestParam Integer showTimes,
                                           @ApiParam(value = "(必填)最小上座率", required = true) @RequestParam Integer minAttendance,
                                           @ApiParam(value = "(必填)其他设备要求", required = true) @RequestParam String otherEquipment,
                                           @ApiParam(value = "(必填)酒店入住天数", required = true) @RequestParam Integer resideInDays,
                                           @ApiParam(value = "(必填)艺人住宿标准", required = true) @RequestParam Integer artistHotelLevel,
                                           @ApiParam(value = "(必填)助理入住标准", required = true) @RequestParam Integer crewHotelLevel,
                                           @ApiParam(value = "(必填)出发地区", required = true) @RequestParam Integer setOffRegion,
                                           @ApiParam(value = "(必填)艺人舱位标准", required = true) @RequestParam Integer artistFlightClass,
                                           @ApiParam(value = "(必填)助理舱位标准", required = true) @RequestParam Integer crewFlightClass,
                                           @ApiParam(value = "(必填)艺人地面交通标准", required = true) @RequestParam Integer artistGroundTransportation,
                                           @ApiParam(value = "(必填)助理地面交通标准", required = true) @RequestParam Integer crewGroundTransportation,
                                           @ApiParam(value = "(必填)是否需要签证", required = true) @RequestParam Boolean needVisa,
                                           @ApiParam(value = "(必填)是否有大型行李", required = true) @RequestParam Boolean hasOversizedLuggage,
                                           @ApiParam(value = "(必填)演出费用", required = true) @RequestParam Integer performanceFee,
                                           @ApiParam(value = "(必填)定金", required = true) @RequestParam Integer earnestMoney,
                                           @ApiParam(value = "(必填)预估最少参与人数", required = true) @RequestParam Integer minTickets,
                                           @ApiParam(value = "(必填)预估成本", required = true) @RequestParam Integer estimateCost,
                                           @ApiParam(value = "(必填)预估最低票价", required = true) @RequestParam Integer estimateTicketPrice) {
        ResponseParameter responseParameter = new ResponseParameter(Message.FAILURE, ADD_FAILURE);
        logger.info("计算众筹申请预估成本请求参数= type：{},token:{},artistNumber:{},crewNumber:{},schedulingDays:{},showScale:{},showTimes:{},minAttendance:{},otherEquipment:{},resideInDays:{}," +
                        "artistHotelLevel:{},crewHotelLevel:{},setOffRegion:{},artistFlightClass:{},crewFlightClass:{},artistGroundTransportation:{},crewGroundTransportation:{},needVisa:{},performanceFee:{},performanceFee:{}",
                type, token, artistNumber, crewNumber, schedulingDays, showScale, showTimes, minAttendance, otherEquipment, resideInDays,
                artistHotelLevel, crewHotelLevel, setOffRegion,artistFlightClass, crewFlightClass, artistGroundTransportation, crewGroundTransportation,
                needVisa, hasOversizedLuggage, performanceFee, earnestMoney);
        if (!CommonValidator.isStringsNotNull(type)) {
            throw new CustomBizException(PARAMETER_IS_NOT_COMPLETE);
        }
        Integer userId = usrService.getUserId(type, token, true);
        Boolean bool = cfiService.setCfiArtistCrowdfundingApplay(userId, availiableScheduleStart, availiableScheduleEnd, artistNumber, crewNumber, targetCity, schedulingDays, showScale, showTimes, minAttendance, otherEquipment, resideInDays,
                artistHotelLevel, crewHotelLevel, setOffRegion, artistFlightClass, crewFlightClass, artistGroundTransportation, crewGroundTransportation, needVisa, hasOversizedLuggage, performanceFee, earnestMoney, minTickets, estimateCost, estimateTicketPrice);
        logger.debug("保存艺人申请的众筹接口响应参数={}", JSON.toJSON(responseParameter));
        if (bool){
            responseParameter.setStatus(SUCCESS);
            responseParameter.setMessage(ADD_SUCCESS);
        }
        return responseParameter;
    }
}
